package com.quarkus.resource;

import com.quarkus.annotation.CustomHttpMethod;
import org.jboss.resteasy.reactive.RestCookie;
import org.jboss.resteasy.reactive.RestForm;
import org.jboss.resteasy.reactive.RestHeader;
import org.jboss.resteasy.reactive.RestMatrix;
import org.jboss.resteasy.reactive.RestPath;
import org.jboss.resteasy.reactive.RestQuery;

import javax.ws.rs.POST;
import javax.ws.rs.Path;

/**
 * @version v1.0
 * @Description: TODO(一句话描述该类的功能)
 * @Author: TongRui乀
 * @Date: 2021/1/24 10:00 上午
 */
@Path("http")
public class HttpDemoResourc {


    @CustomHttpMethod
    public String hello(){
        return "CustomHttpMethod";
    }

    /**
     * @Description:  测试提取Request内容
     *
     *  POST /cheeses;variant=goat/tomme?age=matured HTTP/1.1
     *  Content-Type: application/x-www-form-urlencoded
     *  Cookie: level=hardcore
     *  X-Cheese-Secret-Handshake: fist-bump
     *
     *  smell=strong
     *
     * @param @param
     * @return @return
     * @author TongRui乀
     * @throws
     * @date 2021/1/24 2:07 下午
     */
    @Path("{type}")
    @POST
    public String allParams(@RestPath String type,
                            @RestMatrix String variant,
                            @RestQuery String age,
                            @RestCookie String level,
                            @RestHeader("X-Cheese-Secret-Handshake")
                                    String secretHandshake,
                            @RestForm String smell){
        return type + "/" + variant + "/" + age + "/" + level + "/" + secretHandshake + "/" + smell;
    }

}
